package com.medistat.dialog;

import java.util.Calendar;

import com.medistat.model.Doctor;
import com.medistat.model.enums.Days;
import com.medistat.util.DateUtils;

/**
 * Dialog object for representing Schedule cell in Schedule line for Schedule GUI.
 *
 */
public class ScheduleCell extends AbstractDialogObject implements Comparable<ScheduleCell> {

	private Long doctorId;
	private Doctor doctor;
	private Days day;
	private Calendar date;
	private boolean active = true;
	private ScheduleSelection parent;
	
	public ScheduleCell(ScheduleSelection parent) {
		this.parent = parent;
	}
	
	public ScheduleSelection getParent() {
		return this.parent;
	}

	public Long getDoctorId() {
		return this.doctorId;
	}
	public void setDoctorId(Long doctorId) {
		this.doctorId = doctorId;
	}
	public Doctor getDoctor() {
		return doctor;
	}
	public void setDoctor(Doctor doctor) {
		this.doctor = doctor;
	}
	public Days getDay() {
		return day;
	}
	public void setDay(Days day) {
		this.day = day;
	}
	public Calendar getDate() {
		return date;
	}
	public void setDate(Calendar date) {
		this.date = date;
	}
	public boolean isActive() {
		return active;
	}
	public void setActive(boolean active) {
		this.active = active;
	}
	
	public String getDoctorDescription() {
		if(doctor==null) {
			return "";
		}
		return getDoctor().getSurname();
	}
	
	public String getDateDescription() {
		if(date==null) {
			return "";
		}
		return DateUtils.convertCalendarToStringDate(date);
	}
	
	@Override
	public int compareTo(ScheduleCell cell1) {
		return this.day.compareTo(cell1.getDay());
	}
}
